<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../../js/vue.min.js"></script>
    <script src="../../js/iview.min.js"></script>
    <link rel="stylesheet" href="../../css/iview.css">
</head>
<body>
<div id="app">
    <my-list :books="books">
        <template slot="book" scope="props">
            <li>{{props.bookName}}</li>
        </template>
    </my-list>
</div>
<script>
    Vue.component('my-list', {
        props: {
            books: {
                type: Array,
                default: function () {
                    return [];
                }
            }
        },
        template: "\
        <ul>\
        <slot name='book' v-for='book in books' :book-name='book'></slot>\
        </ul>"
    });
    var app = new Vue({
        el: "#app",
        data: {
            books: [
                {name: '《《Vue.js实战》》', author: "杨翼凡"},
                {name: '《《JavaScript语言精粹》》', author: "杨翼凡"},
                {name: '《《JavaScript高级程序设计》》', author: "杨翼凡"}
            ]
        }
    })
</script>
</body>
</html>